﻿using UnityEngine;
using System.Collections;

public class stateScript : MonoBehaviour 
{
	
	private ScoreManager		scoreMNG;
	
	private int					roundCount;
	
	void Start () 
	{
		scoreMNG = (ScoreManager)FindObjectOfType (typeof(ScoreManager)); 
	}
	
	
	void Update () 
	{
		
	}
	
	public void startRound ()
	{
		//Start round
	}
	
	public void RoundOver()
	{
		roundCount ++; 
		if (roundCount > 4) 
		{
			MatchOver();
		}
		
		Debug.Log (roundCount);
		Debug.Log (scoreMNG.p1Score);
		Debug.Log (scoreMNG.p2Score);
		Debug.Log (scoreMNG.p3Score);
		Debug.Log (scoreMNG.p4Score);
		
	}
	
	private void MatchOver ()
	{
		Debug.Log (roundCount);
		Debug.Log (scoreMNG.p1Score);
		Debug.Log (scoreMNG.p2Score);
		Debug.Log (scoreMNG.p3Score);
		Debug.Log (scoreMNG.p4Score);
		
		RestartGame ();
		
	}
	
	private IEnumerator RestartGame()
	{
		yield return new WaitForSeconds (5f);
		Application.LoadLevel(Application.loadedLevel);
	}
	
}
